import service from "@/utils/request";

export function addClass(data: object) {
  return service({
    url: '/orgs/class/',
    method: 'post',
    data
  })
}

export function updateClass(id: any, data: object) {
  return service({
    url: `/orgs/class/updateClassById/${id}`,
    method: 'put',
    data
  })
}

export function deleteClass(id: string) {
  return service({
    url: `/orgs/class/${id}`,
    method: 'delete',
  })
}

export function importBatch(data: any) {
  return service({
    url: "/orgs/class/batchImportClass",
    method: 'post',
    data
  })
}

export function exportBatch(id: any) {
  return service({
    responseType: 'blob',
    url: "/orgs/class/noAuthExcel/export",
    method: 'get',
    params: {
      deptId: id
    }
  })
}

export function getClassPage(facultyId: string, pageIndex: number, pageSize: number) {
  return service({
    url: `/orgs/class/searchClassByDeptId/${pageIndex}/${pageSize}?deptId=${facultyId}`,
    method: 'get',
  })
}

export function searchFacultyPage(deptId: any, className: string, pageIndex: number, pageSize: number) {
  return service({
    url: `/orgs/class/searchClassByClassName/${pageIndex}/${pageSize}`,
    method: 'get',
    params: {
      className,
      deptId
    }
  })
}